export const highlightKeyword = (text: string, keyword?: string) => {
  if (!keyword) {
    return text;
  }
     // 转义正则特殊字符，防止搜索报错
    const escapedKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    const reg = new RegExp(escapedKeyword, 'gi');
  const matchs=text.match(reg)
  if(!matchs){
    return text
  }
  console.log(text.replace(reg, (match) => `<span class="highlight">${match}</span>`));
  return text.replace(reg, (match) => `<span class="highlight">${match}</span>`);
};